﻿<%@ Control Language="C#" AutoEventWireup="true" CodeFile="TimKiemGiaoDich.ascx.cs"
    Inherits="TimKiemGiaoDich" %>
<asp:Panel runat="server" ID="pnTimKiem">
    <span class="style1"><b>TÌM GIAO DỊCH THEO ĐIỀU KIỆN LỌC</b></span>
    <div style="border-top: 2px gray solid; border-left: 1px solid gray; border-right: 1px solid gray;
        border-bottom: 1px solid gray; background-color: #DDECFE;">
        <table cellpadding="0" cellspacing="10" width="600">
            <tr>
                <td align="left" colspan="2">
                    Từ ngày
                    <input id="txtTuNgay" runat="server" class="TextBoxGachDuoi" ondblclick="selectText(this)"
                        onfocus="showCalendarControl(this);" onkeyup="formatDateInput(this)" style="border-right: pink 1px solid;
                        border-top: pink 1px solid; border-left: pink 1px solid; width: 170px; border-bottom: pink 1px solid"
                        type="text" />&nbsp; Đến ngày
                    <input id="txtDenNgay" runat="server" class="TextBoxGachDuoi" ondblclick="selectText(this)"
                        onfocus="showCalendarControl(this);" onkeyup="formatDateInput(this)" style="border-right: pink 1px solid;
                        border-top: pink 1px solid; border-left: pink 1px solid; width: 170px; border-bottom: pink 1px solid"
                        type="text" visible="true" />
                </td>
            </tr>
        </table>
        <table id="Table1" cellpadding="0" cellspacing="1" class="tableStyle" width="100%">
            <tr class="trStyle">
                <td class="SubHead" ondblclick="phongTo('_ctl2_lstLoaiGiaoDich','_ctl2_lstLoaiGiaoDich2')"
                    style="height: 86px" width="120">
                    <span class="Subhead">Loại giao dịch</span>
                </td>
                <td style="height: 86px">
                    <asp:ListBox ID="lstLoaiGiaoDich" runat="server" DataSourceID="dsLoaiGiaoDich" DataTextField="TenGiaoDich"
                        DataValueField="LoaiGiaoDich" Rows="5" SelectionMode="Multiple" Width="300">
                    </asp:ListBox>
                </td>
                <td class="SubHead" style="height: 86px">
                    <asp:Button ID="btnAddLoaiGiaoDich" runat="server" OnClick="btnAddLoaiGiaoDich_Click"
                        Text="&gt;&gt;" />
                    <br />
                    <asp:Button ID="btnRemoveLoaiGiaoDich" runat="server" OnClick="btnRemoveLoaiGiaoDich_Click"
                        Text="&lt;&lt;" />
                </td>
                <td style="height: 86px">
                    <asp:ListBox ID="lstLoaiGiaoDich2" runat="server" DataTextField="TenGiaoDich" DataValueField="LoaiGiaoDich"
                        Rows="5" SelectionMode="Multiple" Width="300"></asp:ListBox>
                </td>
            </tr>
        </table>
        <asp:SqlDataSource ID="dsLoaiGiaoDich" runat="server" ConnectionString="<%$ ConnectionStrings:DBConnectionString %>"
            ProviderName="<%$ ConnectionStrings:DBConnectionString.ProviderName %>" SelectCommand="loaigiaodich_getAll"
            SelectCommandType="StoredProcedure"></asp:SqlDataSource>
        <table id="tblGRBrn" cellpadding="0" cellspacing="1" class="tableStyle" width="100%">
            <tr class="trStyle">
                <td class="SubHead" ondblclick="phongTo('_ctl2_lstKhoXuat','_ctl2_lstKhoXuat2')"
                    width="120">
                    <span class="Subhead">Kho xuất</span>
                </td>
                <td>
                    <asp:ListBox ID="lstKhoXuat" runat="server" DataSourceID="dsKhoXuat" DataTextField="TenKho"
                        DataValueField="MaKho" Rows="5" SelectionMode="Multiple" Width="300"></asp:ListBox>
                </td>
                <td class="SubHead">
                    <asp:Button ID="btnAddKhoXuat" runat="server" OnClick="btnAddKhoXuat_Click" Text="&gt;&gt;" />
                    <br />
                    <asp:Button ID="btnRemoveKhoXuat" runat="server" OnClick="btnRemoveKhoXuat_Click"
                        Text="&lt;&lt;" />
                </td>
                <td>
                    <asp:ListBox ID="lstKhoXuat2" runat="server" DataTextField="TenKho" DataValueField="MaKho"
                        Rows="5" SelectionMode="Multiple" Width="300"></asp:ListBox>
                </td>
            </tr>
        </table>
        <asp:SqlDataSource ID="dsKhoXuat" runat="server" ConnectionString="<%$ ConnectionStrings:DBConnectionString %>"
            ProviderName="<%$ ConnectionStrings:DBConnectionString.ProviderName %>" SelectCommandType="StoredProcedure">
        </asp:SqlDataSource>
        <table id="tblBrn" cellpadding="0" cellspacing="1" class="tableStyle" width="100%">
            <tr class="trStyle">
                <td class="SubHead" ondblclick="phongTo('_ctl2_lstKhoNhan','_ctl2_lstKhoNhan2')"
                    width="120">
                    <span class="Subhead">Kho nhận</span>
                </td>
                <td>
                    <asp:ListBox ID="lstKhoNhan" runat="server" DataSourceID="dsKhoNhan" DataTextField="TenKho"
                        DataValueField="MaKho" Rows="5" SelectionMode="Multiple" Width="300"></asp:ListBox>
                </td>
                <td class="SubHead">
                    <asp:Button ID="btnAddBrn" runat="server" OnClick="btnAddBrn_Click" Text="&gt;&gt;" />
                    <br />
                    <asp:Button ID="btnRemoveBrn" runat="server" OnClick="btnRemoveBrn_Click" Text="&lt;&lt;" />
                </td>
                <td>
                    <asp:ListBox ID="lstKhoNhan2" runat="server" DataTextField="TenKho" DataValueField="MaKho"
                        Rows="5" SelectionMode="Multiple" Width="300"></asp:ListBox>
                </td>
            </tr>
        </table>
        <asp:SqlDataSource ID="dsKhoNhan" runat="server" ConnectionString="<%$ ConnectionStrings:DBConnectionString %>"
            ProviderName="<%$ ConnectionStrings:DBConnectionString.ProviderName %>" SelectCommandType="StoredProcedure">
        </asp:SqlDataSource>
        <table id="Table4" cellpadding="0" cellspacing="1" class="tableStyle" width="100%">
            <tr class="trStyle">
                <td class="SubHead" width="120">
                    <span class="Subhead">Nội dung giao dịch</span>
                </td>
                <td>
                    <asp:TextBox ID="txtNoiDung" runat="server"></asp:TextBox>
                </td>
                <td class="SubHead">
                </td>
                <td>
                </td>
            </tr>
        </table>
        <asp:Button ID="cmdTimKiem" runat="server" OnClick="cmdTimKiem_Click" Text="Tìm kiếm" />
    </div>
    <br />
    <span class="style1"><b>TÌM GIAO DỊCH THEO SERI</b></span>
    <div style="border-top: 2px gray solid; border-left: 1px solid gray; border-right: 1px solid gray;
        border-bottom: 1px solid gray; background-color: #FFDFEF;">
        <table width="600" cellpadding="0" cellspacing="10">
            <tr>
                <td>
                    Seri:
                    <asp:TextBox runat="server" ID="txtSeri"></asp:TextBox>
                    Từ số:
                    <asp:TextBox runat="server" ID="txtTuSo"></asp:TextBox>
                    Đến số:
                    <asp:TextBox runat="server" ID="txtDenSo"></asp:TextBox>
                </td>
            </tr>
            <tr>
                <td align="center">
                    <asp:Button runat="server" ID="btnTimTheoSeri" Text="Tìm theo seri" 
                        onclick="btnTimTheoSeri_Click" />
                </td>
            </tr>
        </table>
    </div>
</asp:Panel>
<asp:Panel ID="pnGridMaster" runat="server" Width="700px">
    <span class="BigLabel1">KẾT QUẢ TÌM KIẾM</span><asp:DataGrid ID="masterGrid" runat="server"
        AllowPaging="True" AutoGenerateColumns="False" OnItemDataBound="masterGrid_ItemDataBound"
        OnPageIndexChanged="masterGrid_PageIndexChanged" PageSize="15" Width="100%" DataSourceID="ds">
        <PagerStyle Mode="NumericPages" />
        <AlternatingItemStyle CssClass="DarkRow" />
        <ItemStyle CssClass="LightRow" />
        <Columns>
            <asp:BoundColumn HeaderText="M&#227; H&#243;a đơn" DataField="MaHoaDon"></asp:BoundColumn>
            <asp:BoundColumn HeaderText="Trạng th&#225;i" Visible="False" DataField="TrangThai">
            </asp:BoundColumn>
            <asp:BoundColumn HeaderText="Ngày xuất" DataField="NgayXuatThucTe"></asp:BoundColumn>
            <asp:BoundColumn HeaderText="Ngày nhận" DataField="NgayNhanThucTe"></asp:BoundColumn>
            <asp:BoundColumn HeaderText="Kho xuất" DataField="KhoXuat"></asp:BoundColumn>
            <asp:BoundColumn HeaderText="Kho nhận" DataField="KhoNhan"></asp:BoundColumn>
            <asp:BoundColumn HeaderText="Trạng th&#225;i" DataField="TenTrangThai"></asp:BoundColumn>
            <asp:BoundColumn HeaderText="Nội Dung" DataField="NoiDung"></asp:BoundColumn>
            <asp:BoundColumn HeaderText="Người xuất" DataField="UserXuat"></asp:BoundColumn>
            <asp:TemplateColumn>
                <ItemTemplate>
                    <asp:Button ID="cmdXem" runat="server" CausesValidation="False" CommandName="cmdXem"
                        Text="Xem" Width="40" />
                </ItemTemplate>
                <ItemStyle HorizontalAlign="Center" />
            </asp:TemplateColumn>
        </Columns>
        <HeaderStyle CssClass="HeaderRow" Font-Bold="True" />
    </asp:DataGrid>
    <asp:Button ID="btnTimLai" Text="Tìm lại" runat="server" OnClick="btnTimLai_Click" />
</asp:Panel>
<asp:SqlDataSource ID="ds" runat="server" ConnectionString="<%$ ConnectionStrings:DBConnectionString %>"
    SelectCommand="SELECT [CurrCode], [CurrName] FROM [ParCurrency] ORDER BY [CurrCode]"
    ProviderName="<%$ ConnectionStrings:DBConnectionString.ProviderName %>"></asp:SqlDataSource>

<script type="text/javascript" language="javascript">
    //Hàm này để đánh dấu các checkbox trong lst giao dịch đề nghị thực hiện
function clickCheck(abc){
    var c=abc.childNodes[0].childNodes[0];
   
    if(c.checked==true){
    
        abc.style.color="#FF3399";
        abc.style.fontWeight="bold";
    }
    else{
        abc.style.color="black";
        abc.style.fontWeight="normal";
    }
}     
function phongTo(abc,xyz){
    var lst=document.getElementById(abc);
    var lst2=document.getElementById(xyz);
    if(lst.size==5){
        lst.size=40;
        lst2.size=40;
    }
    else{
        lst.size=5;
        lst2.size=5;
    }
}
</script>


